---
id: 6553a7d8d05cbb1ae335a665
title: Step 47
challengeType: 20
dashedName: step-47
---

# --description--

When the loop reaches the letter `Z`, the sum `index + shift` exceeds the length of the string `alphabet`.

In this case, the modulo operator (`%`) can be used to return the remainder of the division between two numbers. For example: `5 % 2` is equal to `1`, because 5 divided by 2 has a quotient of 2 and a remainder of 1.

Surround `index + shift` with parentheses, and modulo the expression with `26`, which is the `alphabet` length.

# --hints--

You should have `new_index = (index + shift) % 26` in your `else` statement.

```js
const commentless_code = __helpers.python.removeComments(code);  
const {block_body} = __helpers.python.getBlock(commentless_code, /else/);
assert(block_body.match(/new_index\s*=\s*\(\s*index\s*\+\s*shift\s*\)\s*%\s*26/));
```

Your code contains invalid syntax and/or invalid indentation.

```js
({test: () => assert(true) })
```

# --seed--

## --seed-contents--

```py
--fcc-editable-region--
text = 'Hello Zaira'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

for char in text.lower():
    if char == ' ':
        encrypted_text += char
    else:
        index = alphabet.find(char)
        new_index = index + shift
        encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)
--fcc-editable-region--
```
